<template>
  <div class="outlibrary">
    <my-head title="出库管理" :isRightClick = "true"/>
    <mu-text-field v-model="vin" v-show='isShowVin' placeholder="VIN" ref="vin" class='input' @keyup.enter.native=""><i class="iconfont icon-saomiao" @click="scan('showVin')"></i></mu-text-field>
    <mu-text-field v-model="surevin" v-show='isShowSurevin' placeholder="VIN" ref="surevin" class='input' @keyup.enter.native="isPickCar()"><i class="iconfont icon-saomiao" @click="scan('sureVin')"></i></mu-text-field>

    <mu-paper class="paper" :z-depth="2" v-show="isShowCardMsg" >
        <div class="list-content"><span class="library-position">{{msg}}</span></div>
    </mu-paper>

    <mu-paper class="paper" :z-depth="2" v-show="isShowCardReceive" >
        <div class="list-content">VIN ：<span>{{vinBefore}}<i class='mark6'>{{vinAfter}}</i></span></div>
      <div class="list-content">任务类型：{{infoForm.taskType}}</div>
      <div class="list-content">取车库位：<span class="library-position">{{infoForm.pickLocation}}</span></div>
      <div class="list-content">备注详情：<span :class="isVinSys?'library-position':''">{{infoForm.remark}}</span></div>
    </mu-paper>

    <mu-paper class="paper" :z-depth="2" v-show="isShowCardGetOnCar" >
        <div class="list-content">VIN ：<span>{{vinBefore}}<i class='mark6'>{{vinAfter}}</i></span></div>
        <div class="list-content">任务类型：<span>{{infoForm.taskType}}</span></div>
        <div class="list-content">交通车：<span class="library-position">{{infoForm.bus}}</span></div>
        <div class="list-content">交通车状态：<span class="library-position">{{infoForm.busStatus}}</span></div>
        <div class="list-content">上车站点：<span>{{infoForm.busPosition}}</span></div>
        <div class="list-content">取车库位：<span class="library-position">{{infoForm.pickLocation}}</span></div>
        <div class="list-content">备注详情：<span :class="isVinSys?'library-position':''">{{infoForm.remark}}</span></div>
        <div class="list-content">
          <mu-button color="primary" @click="seeMaps">查看地图</mu-button>
        </div>
    </mu-paper>

    <mu-paper class="paper2" :z-depth="2" v-show="isShowCardTiaoCar" >
        <div class="list-content2">VIN ：<span>{{vinBefore}}<i class='mark6'>{{vinAfter}}</i></span></div>
        <div class="list-content2">车型：<span>{{infoForm.carType}}</span><em></em>颜色：<span>{{infoForm.color}}</span></div>
        <div class="list-content2"><span v-show='shows'>板号：<span>{{infoForm.cmalTrailSeq}}</span><em></em></span>补油：<span class="library-position">{{infoForm.oil}}</span></div>
        <div class="list-content2">任务类型：<span>{{infoForm.taskType}}</span></div>
        <div class="list-content2" v-show='shows'>经销商：<span>{{infoForm.company}}</span></div>
        <div class="list-content2" v-show='shows'>承运商：<span>{{infoForm.carrier}}</span></div>
        <div class="list-content2" v-show='shows'>运输方式：<span>{{infoForm.transportMode}}</span></div>
        <div class="list-content2">取车库位：<span class="library-position">{{infoForm.pickLocation}}</span></div>
        <div class="list-content2">目标库位：<span class="library-position2">{{infoForm.targetLocation|ellipsis}}</span></div>
        <div class="list-content2" v-if="infoForm.taskType === '挑车出库'">是否洗车：<span class="library-position">{{infoForm.isWashCar}}</span></div>
        <div class="list-content2 description">备注详情：<span :class="isVinSys?'library-position':''">{{infoForm.remark}}</span></div>
    </mu-paper>

    <div class="btn">
        <mu-button large v-show="refuse" color="primary" @click="openBottomSheet()">拒绝任务</mu-button>
        <mu-button large v-show="receive" color="primary" @click="userActive(1)">领取任务</mu-button>
        <mu-button large v-show="cancel" color="primary" @click="isGetOnCar(0)">取消乘车</mu-button>
        <mu-button large v-show="getOn" color="primary"  @click="isGetOnCar(1)">上车确认</mu-button>
        <mu-button large v-show="abnormal" color="primary" @click="goAbnormal">异常上报</mu-button>
        <mu-button large v-show="pickCar" color="primary" @click="isPickCar()">取车确认</mu-button>
        <mu-button large v-show="done" color="primary" @click="viewVol()">查看电压</mu-button>
        <mu-button large v-show="done" color="primary" @click="isTaskDone()">确认完成</mu-button>
        <mu-button large v-show="fixDone" color="primary" @click="taskDone(1)">{{titleA || '维修完成'}}</mu-button>
        <mu-button large v-show="carStay" color="primary" @click="taskDone(2)">{{titleB || '留车维修'}}</mu-button>
        <mu-button large v-show="isShowBle" color="primary" @click="gotoble">电压获取</mu-button>
    </div>


    <mu-dialog title="电压信息" width="360" :open.sync="openVol">
      <div class="vol">
        <h3>DATETIME: <span>{{curVol.dateTime}}</span></h3>
        <h3>VIN: <span>{{vinBefore+vinAfter}}</span></h3>
        <h4>SOC: <span>{{curVol.soc}}</span></h4>
        <h4>TIS: <span>{{curVol.tis}}</span></h4>
        <h4>VOLTAGE: <span>{{curVol.voltage}}</span></h4>
        <h4>KOL: <span>{{curVol.kol}}</span></h4>
        <h4>TEMP: <span>{{curVol.tempStr}}</span></h4>
        <h4>SOCTHRESHOLD: <span>{{curVol.socthreshold}}</span></h4>
        <h4>VOLTHRESHOLD: <span>{{curVol.volthreshold}}</span></h4>
        <h4>STATUS: <span>{{curVol.status}}</span></h4>
        <h4>MODE: <span>{{curVol.modeStr}}</span></h4>
        <h4>LAT: <span>{{curVol.lat}}</span></h4>
        <h4>long: <span>{{curVol.longStr}}</span></h4>
      </div>
      <mu-button slot="actions" flat color="primary" @click="openVol=false">关闭</mu-button>
    </mu-dialog>

    <mu-bottom-sheet :open.sync="openRefuseReasons">
        <mu-list @item-click="closeBottomSheet">
            <mu-sub-header>请拒绝原因</mu-sub-header>
            <mu-list-item button v-for="(item,index) in refuseReasons" :key="index" @click="userActive(0, item.reason)">
                <mu-list-item-title>{{item.reason}}</mu-list-item-title>
            </mu-list-item>
        </mu-list>
    </mu-bottom-sheet>
    <mu-dialog title="是否确认完成?" width="600" max-width="80%" :esc-press-close="false" :overlay-close="false" :open.sync="isuredoneDialog">
        <mu-button slot="actions" flat color="primary" @click="sureDone()">是</mu-button>
        <mu-button slot="actions" flat color="primary" @click="closeThisConfirm">否</mu-button>
    </mu-dialog>
    <div class="targetLocation" ref="test" @click="watchTest">
        当前库位坐标
        <div>经：{{longitude}}</div>
        <div>纬：{{latitude}}</div>
        <div>半径：{{railRadius}}</div>
        <div>距离：{{lengths}}</div>
    </div>
    <mu-dialog title="提示" width="360" :open.sync="openMovePage">
      {{tips}}，即将跳转到移位管理。
      <mu-button slot="actions" flat color="primary" @click="gotoMovePage">跳转</mu-button>
    </mu-dialog>
    <scanning v-if="isScanning" :mark="scanMark" v-on:childByValue="childByValue" v-on:closeing="closeing"/>
  </div>
</template>

<script>
import myHead from '@/components/header'
import scanning from "@/components/scanning"
import api from "@/common/api"
export default {
  name: 'outlibrary',
  components: {
    myHead, scanning
  },
  data () {
    return {
      tips: "",
      isShowBle: false,
      openVol: false,
        openMovePage: false,
        scanMark: '',
        isScanning: false,
        iswatchTest: false,
        isuredoneDialog: false,
        surevin: '',
        openRefuseReasons: false,
        refuseReasons: [],
        isShowSurevin: false,
        msg: "当前无任务",
        titleA:"",
        titleB:"",
        curVol: {
          voltage: "",
          tis: "",
          soc: "",
          dateTime: "",
          kol: "",
          tempStr: "",
          socthreshold: "",
          volthreshold: "",
          status: "",
          modeStr: "",
          lat: "",
          longStr: ""
        },
        infoForm: {
          taskType: '',
          pickLocation: '',
          busPosition: '',
          bus: '',
          carType: '',
          color: '',
          cmalTrailSeq: '',
          oil: '',
          company: '',
          carrier: '',
          transportMode: '',
          targetLocation: '',
          busStatus: '',
          remark: '',
          isWashCar: ""
        },
        vin: '',
        vinBefore: '',
        vinAfter: '',
        isShowVin: false,
        isShowCardReceive: false,
        isShowCardGetOnCar: false,
        isShowCardTiaoCar: false,
        isShowCardMsg: false,
        refuse: false,
        receive: false,
        cancel: false,
        getOn: false,
        abnormal: false,
        pickCar: false,
        done: false,
        fixDone: false,
        shows: true,
        carStay: false,
        latitude: 0,
        longitude: 0,
        dlatitude: 0,
        dlongitude: 0,
        railRadius: 10,
        lengths: 0,
        isDisCompute: true,
        requestOnce: true,
        isVinSys:false
    }
  },
  methods: {
    closeing (val) {
      val ? this.isScanning = false : null;
    },
    childByValue (val) {
      if(val){
        if(val.split('&')[1] == 'showVin'){
          this.vin = val.split('&')[0];
        }else if(val.split('&')[1] == 'sureVin'){
          this.surevin = val.split('&')[0];
          this.isPickCar();
        }
      }
    },
    scan (txt) {
      this.scanMark = txt;
      this.isScanning = true;
    },
    watchTest(){
      if(this.iswatchTest){
        this.$refs.test.classList.remove('hover')
      }else{
        this.$refs.test.classList.add('hover')
      }
      this.iswatchTest = !this.iswatchTest;
    },
    seeMaps () {
      this.$router.push({name:'maps', params: {
        marks: [{
          latitude: this.dlatitude,
          longitude: this.dlongitude,
          name: "出库交通车",
          phone: "出库交通车"
        }],
        flag: 0
      }});
    },
    viewVol(){
      if(this.requestOnce){
        this.requestOnce = false;
        let data = Object.assign({},this.$store.state.user,{
            content: {
              vin: this.vinBefore + this.vinAfter
            }
        });
        this.common.reqData(api.app('searchVol'), data, res=>{
          this.requestOnce = true;
          if(res.data.status == 100){
            this.curVol = res.data.content.curVol;
          }else{
            this.Toast({
              duration: 0,
              mask: true,
              message: res.data.msg
            });
          }
        },err =>{
            this.requestOnce = true;
            console.log(err)
            this.Toast.clear();
        });
      }
      this.openVol = true;
    },
    isTaskDone () {
      if(this.latitude == 0 || this.longitude == 0){
        this.isuredoneDialog = true;
        return ;
      }
      // 确认完成
      this.disCompute("MANUAL", ()=>{
        // 在电子围栏半径内
        this.isuredoneDialog = true;
      });
    },
    sureDone(){
      this.taskDone(0, 'MANUAL');
      this.isuredoneDialog = false;
    },
    closeThisConfirm(){
      this.isuredoneDialog = false;
    },
    /* 任务完成 */
    taskDone (flag, manual) {
      if(this.requestOnce){
        this.requestOnce = false;
        let data = Object.assign({},this.$store.state.user,{
            content: {
              vin: this.vinBefore + this.vinAfter,
              flag: flag,
              action: manual ? manual : -1
            }
        });
        this.common.reqData(api.app('outlibraryDone'), data, res=>{
          this.requestOnce = true;
          let datas = res.data;
          if(datas.status == 100){
            if(flag == 0){
              this.Toast.success({
                duration: 1500,
                mask: true,
                message: "已确认完成"
              });
              this.abnormal = this.done = false;
              manual == "RAIL" ? this.common.tts("任务已自动完成") : 0;
              this.longitude = this.latitude = 0;
              this.isDisCompute = false;
            }else if(flag == 1){
              this.Toast.success({
                duration: 1500,
                mask: true,
                message: "已维修"
              });
              this.fixDone = this.carStay = false;
              setTimeout(() => {
                this.$router.push({name:'transposing'});
              }, 1200);
            }else{
              this.Toast.success({
                duration: 1500,
                mask: true,
                message: "已留车"
              });
              this.fixDone = this.carStay = false;
            }
          }else{
            this.Toast({
              duration: 0,
              mask: true,
              message: datas.msg
            });
          }
        },err =>{
            this.requestOnce = true;
            console.log(err)
            this.Toast.clear();
        });
      }else{
        return false;
      }
    },
    /* 取车 */
    isPickCar () {
      let data = null;
      let myvin = this.vinBefore + this.vinAfter;
      if(this.surevin == ''){
        data = Object.assign({},this.$store.state.user,{
            content: {
              vin: myvin,
              issurevin: false
            }
        });
      }else{
        if(this.surevin == myvin){
            data = Object.assign({},this.$store.state.user,{
                content: {
                  vin: myvin,
                  issurevin: true
                }
            });
        }else{
            this.Toast({
              duration: 2000,
              mask: true,
              message: "VIN验证错误"
            });
            return false;
        }
      }
      if(this.requestOnce){
        this.requestOnce = false;
        this.common.reqData(api.app('isPickCar'), data, res=>{
          this.requestOnce = true;
          let datas = res.data;
          if(datas.status == 100){
            console.log('flag',datas.content.flag);
            if(datas.content.flag == 0){
              // 待完成
              this.isShowSurevin = false;
              this.isShowVin = false;
              this.refuse = false, this.receive = false, this.cancel = false, this.getOn = false, this.abnormal = true, this.pickCar = false, this.done = true, this.fixDone = false, this.carStay = false;
            }else{
              // 待维修
              this.isShowSurevin = false;
              this.isShowVin = false;
              this.refuse = false, this.receive = false, this.cancel = false, this.getOn = false, this.abnormal = true, this.pickCar = false, this.done = false, this.fixDone = true, this.carStay = true;
            }
            if(datas.content.billType == "WashCar"){
              this.titleA = "洗车完成";
              this.titleB = "留车清洗";
            }
          }else{
            this.Toast.fail({
                duration: 1000,
                mask: true,
                message: data.msg
            });
          }
        },err =>{
          this.requestOnce = true
          console.log(err)
          this.Toast.clear();
        });
      }
    },
    /* 上车确认 */
    isGetOnCar (flag) {
      let data = Object.assign({},this.$store.state.user,{
          content: {
              flag: flag
          }
      });
      if(this.requestOnce){
        this.requestOnce = false;
        this.common.reqData(api.app('busUpdate'), data, res=>{
            console.log(res.data);
            this.requestOnce = true;
            if(res.data.status == 100){
              if(flag == 0){
                  this.Toast.success({
                      duration: 1000,
                      mask: true,
                      message: '已取消乘车'
                  });
              }else{
                  this.Toast.success({
                      duration: 1000,
                      mask: true,
                      message: '已上车'
                  });
              }
              this.oneResdata(data);
            }else{
              this.Toast({
                duration: 1000,
                mask: true,
                message: res.data.msg
              });
              this.requestOnce = true
            }
        },err =>{
            console.log(err)
        });
      }
    },
    /* 异常跳转 */
    goAbnormal () {
      this.$router.push({name: "abnormal", params: {vin: this.vinBefore+this.vinAfter}});
    },
    /* 关闭选项 */
    closeBottomSheet () {
        this.openRefuseReasons = false;
    },
    /* 打开选项 */
    openBottomSheet () {
        this.openRefuseReasons = true;
    },
    /* 用户动作 领取 拒绝任务*/
    userActive (flag, reason) {
      let data = Object.assign({},this.$store.state.user,{
          content: {
              vin: this.vin,
              flag: flag
          }
      });
      if(flag == 0){
        data = Object.assign({},this.$store.state.user,{
            content: {
              vin: this.vin,
              flag: flag,
              reason: reason
            }
        });
      }
      if(this.requestOnce){
        this.requestOnce = false;
        this.common.reqData(api.app('outlibraryIsReceive'), data, res=>{
          this.requestOnce = true;
          let datas = res.data;
          console.log(datas);
          if(datas.status == 100){
            if(flag == 0){
              this.Toast.success({
                  duration: 1000,
                  mask: true,
                  message: "已拒绝任务"
              });
              this.isShowCardMsg = true;
              this.msg = "拒绝任务，已暂停接单!", this.isShowCardReceive = false, this.refuse = false, this.receive = false;
            }else{
              this.Toast.success({
                duration: 1000,
                mask: true,
                message: "已领取任务"
              });
              this.oneResdata(data);
            }
          }else{
            this.Toast.fail({
              duration: 1000,
              mask: true,
              message: datas.msg
            });
          }
        },err =>{
          this.requestOnce = true
          console.log(err)
          this.Toast.clear();
        });
      }
    },
    /* 进入页面的第一次查询 */
    oneResdata (data) {
      this.common.reqData(api.app('outlibrary'), data, res=>{
        console.log(res);
        let data = res.data;
        if(data.status == 100){
          if(!data.content){
            this.isShowCardReceive = false,
            this.isShowCardGetOnCar = false,
            this.isShowCardTiaoCar = false,
            this.isShowCardMsg = true;
            this.isShowVin = false;
            this.isShowSurevin = false;
          }else if(data.content.flag == 0){
            // 待领取
            this.isShowVin = false;
            this.isShowCardReceive = true,
            this.isShowCardGetOnCar = false,
            this.isShowCardTiaoCar = false,
            this.isShowCardMsg = false;
            this.isShowSurevin = false;
            this.vin = data.content.vin;
            this.stringVinSplit(data.content.vin);
            this.infoForm.taskType = data.content.taskType;
            this.infoForm.pickLocation = data.content.pickLocation;
            this.infoForm.remark = data.content.remark;
            this.isVinSys=data.content.isVinSys=='是' ? true : false;
            this.latitude = data.content.latitude;
            this.longitude = data.content.longitude;
            this.railRadius = data.content.railRadius;
            this.dlatitude = data.content.dlatitude;
            this.dlongitude = data.content.dlongitude;
            this.refuse = true, this.receive = true, this.cancel = false, this.getOn = false, this.abnormal = false, this.pickCar = false, this.done = false, this.fixDone = false, this.carStay = false;
          }else if(data.content.flag == 1){
            // 待上车
            this.isShowSurevin = false;
            this.isShowVin = false;
            this.isShowCardReceive = false,
            this.isShowCardGetOnCar = true,
            this.isShowCardTiaoCar = false,
            this.isShowCardMsg = false;
            this.vin = data.content.vin;
            this.stringVinSplit(data.content.vin);
            this.infoForm.taskType = data.content.taskType;
            this.infoForm.pickLocation = data.content.pickLocation;
            this.infoForm.bus = data.content.busNo;
            this.infoForm.busPosition = data.content.boradPoint;
            this.infoForm.busStatus = data.content.busStatus;
            this.infoForm.remark = data.content.remark;
            this.isVinSys=data.content.isVinSys=='是' ? true : false;
            this.latitude = data.content.latitude;
            this.longitude = data.content.longitude;
            this.dlatitude = data.content.dlatitude;
            this.dlongitude = data.content.dlongitude;
            this.railRadius = data.content.railRadius;
            this.refuse = false, this.receive = false, this.cancel = true, this.getOn = true, this.abnormal = false, this.pickCar = false, this.done = false, this.fixDone = false, this.carStay = false;
            if(this.infoForm.bus == "" || !data.content.busNo){
              this.getOn = false;
            }
          }else{
            (data.content.show == 0) ? this.shows = false : this.shows = true;
            this.isShowCardReceive = false,
            this.isShowCardGetOnCar = false,
            this.isShowCardTiaoCar = true,
            this.isShowCardMsg = false;
            this.isShowSurevin = false;
            this.stringVinSplit(data.content.vin);
            this.infoForm.taskType = data.content.taskType;
            this.infoForm.pickLocation = data.content.pickLocation;
            this.infoForm.carType = data.content.vehicleType;
            this.infoForm.color = data.content.color;
            this.infoForm.cmalTrailSeq = data.content.cmalTrailSeq;
            this.infoForm.oil = data.content.oil;
            this.infoForm.company = data.content.company;
            this.infoForm.carrier = data.content.carrier;
            this.infoForm.transportMode = data.content.transportMode;
            this.infoForm.targetLocation = data.content.targetLocation;
            this.infoForm.remark = data.content.remark;
            this.isVinSys=data.content.isVinSys=='是' ? true : false;
            this.latitude = data.content.latitude;
            this.longitude = data.content.longitude;
            this.railRadius = data.content.railRadius;
            this.dlatitude = data.content.dlatitude;
            this.dlongitude = data.content.dlongitude;
            if(data.content.taskType == "挑车出库" && data.content.isWashCar){
              this.infoForm.taskType = data.content.taskType;
              this.infoForm.isWashCar = data.content.isWashCar;
            }
            if(data.content.billType == "WashCar"){
              this.titleA = "洗车完成";
              this.titleB = "留车清洗";
            }
            if(data.content.flag == 2){
              // 待取车
              this.isShowSurevin = true;
              setTimeout(() => {
                  this.$refs.surevin.$el.children[0].getElementsByTagName('input')[0].focus();
                  window.plus ? plus.key.hideSoftKeybord() : 0;
              }, 50);
              this.isShowVin = false;
              this.refuse = false, this.receive = false, this.cancel = false, this.getOn = false, this.abnormal = true, this.pickCar = true, this.done = false, this.fixDone = false, this.carStay = false;
            }else if(data.content.flag == 3){
              // 待维修
              this.isShowVin = false;
              this.isShowSurevin = false;
              this.refuse = false, this.receive = false, this.cancel = false, this.getOn = false, this.abnormal = true, this.pickCar = false, this.done = false, this.fixDone = true, this.carStay = true;
            }else if(data.content.flag == 4){
              // 待完成
              this.isShowVin = false;
              this.isShowSurevin = false;
              this.refuse = false, this.receive = false, this.cancel = false, this.getOn = false, this.abnormal = true, this.pickCar = false, this.done = true, this.fixDone = false, this.carStay = false;
            }else if(data.content.flag == 6){
              if(data.content.tips){
                this.tips = data.content.tips;
                setTimeout(() => {
                  this.openMovePage = true
                }, 2000);
              }
              // data.content.tips && this.$alert(data.content.tips + '即将跳转到移位管理.', '提示', {
              //   okLabel: '知道了'
              // }).then(() => {
              //   this.$router.push({ path: "/transposing" });
              //   // this.$toast.message('提示信息 transposing');
              // });
            }else if(data.content.flag == 7){
              this.isShowBle = true;
                // setTimeout(() => {


                //   this.Toast.clear();
                //   // this.openMovePage = true
                // }, 2000);
            }

            data.content.tips && this.Toast({
              mask: true,
              message: data.content.tips
            });
          }

        }else{
          this.Toast({
            mask: true,
            message: res.data.msg
          });
        }
      },err =>{
          console.log(err)
          this.Toast.clear();
      });
    },
    gotoble(){
      this.$router.push({ path: "/ble?fromWhere=2" });
    },
    gotoMovePage(){
      this.$router.push({ path: "/transposing" });
    },
    /* 字符串切割 */
    stringVinSplit (str) {
      let a = str.length - 6,
          b = str.length;
      this.vinBefore = str.substring(0,a);
      this.vinAfter = str.substring(a,b);
    },
    disCompute (manual, func) {
      console.log('定位或速度已经改变'+this.$store.state.latitude+"-"+this.$store.state.longitude+"-"+this.latitude+"-"+this.longitude+"-"+this.isDisCompute)
      if(this.isDisCompute){
        this.common.distanceCompute({
          latitude: this.latitude,
          longitude: this.longitude
        },{
          latitude: this.$store.state.latitude,
          longitude: this.$store.state.longitude
        }, this.railRadius, ()=>{
          this.taskDone(0, manual)
        }, func);
        // 测试用距离计算
        let _this = this;
        let selfPoint = new plus.maps.Point(this.longitude, this.latitude)
        let targetPoint = new plus.maps.Point(this.$store.state.longitude, this.$store.state.latitude)
        plus.maps.Map.calculateDistance(targetPoint, selfPoint, function (event) {
          var distance = event.distance // 转换后的距离值
          _this.lengths = distance
        }, function (e) {
          console.log('Failed:' + JSON.stringify(e))
        })
      }
    }
  },
  mounted () {
    let data = null;
    if(this.$route.params.vin){
      console.log('111111111', this.$store.state.user);
      data = Object.assign({},this.$store.state.user,{
        content:{
          vin: this.$route.params.vin
        }
      });
    }else{
      console.log('111111111', this.$store.state.user);
      data = this.$store.state.user;
    }
    this.oneResdata(data);
    // 拒绝原因
    this.refuseReasons = this.$store.state.refuseReasons;
  },
  computed: {
    latitudeChange () {
      return this.$store.state.latitude;
    },
    longitudeChange () {
      return this.$store.state.longitude;
    },
    speedChange () {
      return this.$store.state.speed;
    }
  },
  watch:{
    latitudeChange: function(data) {
      this.disCompute("RAIL");
    },
    longitudeChange: function(data) {
      this.disCompute("RAIL");
    },
    speedChange: function(data) {
      this.disCompute("RAIL");
    }
  },
  filters: {
    // 当标题字数超出时，超出部分显示’...‘。此处限制超出8位即触发隐藏效果
    ellipsis (value) {
      if (!value) return ''
      if (value.length > 30) {
        return value.slice(0, 30) + '...'
      }
      return value
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.outlibrary{
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}
.btn{
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
}
.btn .mu-raised-button{
  font-size: 18px;
  height: 40px;
  line-height: 40px;
}
.input{
    display: block;
    margin: 15px auto;
    width: 85%;
}
.paper, .state, .msg{
    width: 85%;
    margin: 1em auto 0;
    padding: 1.5em 0;
}
.paper2{
  width: 85%;
  margin: 1em auto 0;
  padding: 1em 0;
}
.list-content2{
  padding: 3px 10px;
}
.list-content{
    padding: 5px 20px;
}
.library-position{
    font-size: 1.5em;
    font-weight: bold;
    color: red;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}
.library-position2{
  font-size: 1.5em;
  font-weight: bold;
  color: red;
  text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
  overflow: hidden;
  word-break: break-all;
  text-overflow: ellipsis;
  height:10px;
  overflow-y:auto;
}
em{
  padding: 0 10px;
}
.mark6{
  font-style: normal;
  color: red;
  font-size: 1.25em;
}
.vol span{
  font-weight: normal;
  color: red;
}
.description{
  height:100px;
  overflow-y:auto;
}
</style>
